local lapis = require("lapis")
local app = lapis.Application()

-- Habilita el sistema de plantillas "etlua".
app:enable("etlua")

-- Deshabilita el sistema de "generación de còdigo HTML".
app.layout = false

-- Sistema de rutas.
app:get("index",            "/",                    require("components.index"))
app:match("signup",         "/signup",              require("components.signup"))
app:match("login",          "/login",               require("components.login"))
app:get("logout",           "/logout",              require("components.logout"))
app:get("verification",     "/verification/:token", require("components.verification"))
app:get("profile",          "/profile/:username",   require("components.profile"))
app:get("search",           "/search",              require("components.search"))
app:match("edit_profile",   "/edit/profile",        require("components.edit_profile"))
app:match("upload_article", "/upload/article",      require("components.upload_article"))

-- Redirecciona rutas no válidas hacia la página principal del sitio web.
function app:default_route() return { redirect_to = self:url_for("index") } end

return app
